//    Copyright (C) 2013  <lugocreation@gmail.com>
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.jpgolay.me.print.options;

import java.awt.*;
import javax.swing.*;

// Referenced classes of package org.jpgolay.me.print.options:
//            PrintPiecesPanel
public class PrintOptionsGUI extends JInternalFrame {

    public PrintOptionsGUI() {
        jContentPane = null;
        jTabbedPane = null;
        customerQuotePanel = null;
        customerOrderPanel = null;
        customerDeliveryPanel = null;
        customerBillPanel = null;
        customerAssetPanel = null;
        supplierOrderPanel = null;
        supplierBillPanel = null;
        supplierAssetPanel = null;
        customerQuotePrintPiecesPanel = null;
        customerOrderPrintPiecesPanel = null;
        customerDeliveryPrintPiecesPanel = null;
        customerBillPrintPiecesPanel = null;
        customerAssetPrintPiecesPanel = null;
        supplierOrderPrintPiecesPanel = null;
        supplierBillPrintPiecesPanel = null;
        supplierAssetPrintPiecesPanel = null;
        jPanel = null;
        saveButton = null;
        initialize();
    }

    private void initialize() {
        setFrameIcon(new ImageIcon(getClass().getResource("/org/jpgolay/me/images/print.gif")));
        setTitle("Options d'impression des Pi\350ces");
        setSize(800, 535);
        setContentPane(getJContentPane());
    }

    private JPanel getJContentPane() {
        if (jContentPane == null) {
            jContentPane = new JPanel();
            jContentPane.setLayout(new BorderLayout());
            jContentPane.add(getJTabbedPane(), "Center");
            jContentPane.add(getJPanel(), "North");
        }
        return jContentPane;
    }

    private JTabbedPane getJTabbedPane() {
        if (jTabbedPane == null) {
            jTabbedPane = new JTabbedPane();
            jTabbedPane.setTabLayoutPolicy(1);
            jTabbedPane.addTab("DEVIS", new ImageIcon(getClass().getResource("/org/jpgolay/me/images/customerList16x16.png")), getCustomerQuotePanel(), "Devis client");
            jTabbedPane.addTab("COMMANDE", new ImageIcon(getClass().getResource("/org/jpgolay/me/images/customerList16x16.png")), getCustomerOrderPanel(), "Commande client");
            jTabbedPane.addTab("BL", new ImageIcon(getClass().getResource("/org/jpgolay/me/images/customerList16x16.png")), getCustomerDeliveryPanel(), "BL client");
            jTabbedPane.addTab("FACTURE", new ImageIcon(getClass().getResource("/org/jpgolay/me/images/customerList16x16.png")), getCustomerBillPanel(), "Facture client");
            jTabbedPane.addTab("AVOIR", new ImageIcon(getClass().getResource("/org/jpgolay/me/images/customerList16x16.png")), getCustomerAssetPanel(), "Avoir client");
            jTabbedPane.addTab("COMMANDE", new ImageIcon(getClass().getResource("/org/jpgolay/me/images/supplierList16x16.png")), getSupplierOrderPanel(), "Commande fournisseur");
            jTabbedPane.addTab("FACTURE", new ImageIcon(getClass().getResource("/org/jpgolay/me/images/supplierList16x16.png")), getSupplierBillPanel(), "Facture fournisseur");
            jTabbedPane.addTab("AVOIR", new ImageIcon(getClass().getResource("/org/jpgolay/me/images/supplierList16x16.png")), getSupplierAssetPanel(), "Avoir fournisseur");
        }
        return jTabbedPane;
    }

    private JPanel getCustomerQuotePanel() {
        if (customerQuotePanel == null) {
            customerQuotePanel = new JPanel();
            customerQuotePanel.setLayout(new BorderLayout());
            customerQuotePanel.add(getCustomerQuotePrintPiecesPanel(), "Center");
        }
        return customerQuotePanel;
    }

    private JPanel getCustomerOrderPanel() {
        if (customerOrderPanel == null) {
            customerOrderPanel = new JPanel();
            customerOrderPanel.setLayout(new BorderLayout());
            customerOrderPanel.add(getCustomerOrderPrintPiecesPanel(), "Center");
        }
        return customerOrderPanel;
    }

    private JPanel getCustomerDeliveryPanel() {
        if (customerDeliveryPanel == null) {
            customerDeliveryPanel = new JPanel();
            customerDeliveryPanel.setLayout(new BorderLayout());
            customerDeliveryPanel.add(getCustomerDeliveryPrintPiecesPanel(), "Center");
        }
        return customerDeliveryPanel;
    }

    private JPanel getCustomerBillPanel() {
        if (customerBillPanel == null) {
            customerBillPanel = new JPanel();
            customerBillPanel.setLayout(new BorderLayout());
            customerBillPanel.add(getCustomerBillPrintPiecesPanel(), "Center");
        }
        return customerBillPanel;
    }

    private JPanel getCustomerAssetPanel() {
        if (customerAssetPanel == null) {
            customerAssetPanel = new JPanel();
            customerAssetPanel.setLayout(new BorderLayout());
            customerAssetPanel.add(getCustomerAssetPrintPiecesPanel(), "Center");
        }
        return customerAssetPanel;
    }

    private JPanel getSupplierOrderPanel() {
        if (supplierOrderPanel == null) {
            supplierOrderPanel = new JPanel();
            supplierOrderPanel.setLayout(new BorderLayout());
            supplierOrderPanel.add(getSupplierOrderPrintPiecesPanel(), "Center");
        }
        return supplierOrderPanel;
    }

    private JPanel getSupplierBillPanel() {
        if (supplierBillPanel == null) {
            supplierBillPanel = new JPanel();
            supplierBillPanel.setLayout(new BorderLayout());
            supplierBillPanel.add(getSupplierBillPrintPiecesPanel(), "Center");
        }
        return supplierBillPanel;
    }

    private JPanel getSupplierAssetPanel() {
        if (supplierAssetPanel == null) {
            supplierAssetPanel = new JPanel();
            supplierAssetPanel.setLayout(new BorderLayout());
            supplierAssetPanel.add(getSupplierAssetPrintPiecesPanel(), "Center");
        }
        return supplierAssetPanel;
    }

    private PrintPiecesPanel getCustomerQuotePrintPiecesPanel() {
        if (customerQuotePrintPiecesPanel == null) {
            customerQuotePrintPiecesPanel = new PrintPiecesPanel();
        }
        return customerQuotePrintPiecesPanel;
    }

    private PrintPiecesPanel getCustomerOrderPrintPiecesPanel() {
        if (customerOrderPrintPiecesPanel == null) {
            customerOrderPrintPiecesPanel = new PrintPiecesPanel();
        }
        return customerOrderPrintPiecesPanel;
    }

    private PrintPiecesPanel getCustomerDeliveryPrintPiecesPanel() {
        if (customerDeliveryPrintPiecesPanel == null) {
            customerDeliveryPrintPiecesPanel = new PrintPiecesPanel();
        }
        return customerDeliveryPrintPiecesPanel;
    }

    private PrintPiecesPanel getCustomerBillPrintPiecesPanel() {
        if (customerBillPrintPiecesPanel == null) {
            customerBillPrintPiecesPanel = new PrintPiecesPanel();
        }
        return customerBillPrintPiecesPanel;
    }

    private PrintPiecesPanel getCustomerAssetPrintPiecesPanel() {
        if (customerAssetPrintPiecesPanel == null) {
            customerAssetPrintPiecesPanel = new PrintPiecesPanel();
        }
        return customerAssetPrintPiecesPanel;
    }

    private PrintPiecesPanel getSupplierOrderPrintPiecesPanel() {
        if (supplierOrderPrintPiecesPanel == null) {
            supplierOrderPrintPiecesPanel = new PrintPiecesPanel();
        }
        return supplierOrderPrintPiecesPanel;
    }

    private PrintPiecesPanel getSupplierBillPrintPiecesPanel() {
        if (supplierBillPrintPiecesPanel == null) {
            supplierBillPrintPiecesPanel = new PrintPiecesPanel();
        }
        return supplierBillPrintPiecesPanel;
    }

    private PrintPiecesPanel getSupplierAssetPrintPiecesPanel() {
        if (supplierAssetPrintPiecesPanel == null) {
            supplierAssetPrintPiecesPanel = new PrintPiecesPanel();
        }
        return supplierAssetPrintPiecesPanel;
    }

    public PrintPiecesPanel getCustomerQuotePrintPieces() {
        return getCustomerQuotePrintPiecesPanel();
    }

    public PrintPiecesPanel getCustomerOrderPrintPieces() {
        return getCustomerOrderPrintPiecesPanel();
    }

    public PrintPiecesPanel getCustomerDeliveryPrintPieces() {
        return getCustomerDeliveryPrintPiecesPanel();
    }

    public PrintPiecesPanel getCustomerBillPrintPieces() {
        return getCustomerBillPrintPiecesPanel();
    }

    public PrintPiecesPanel getCustomerAssetPrintPieces() {
        return getCustomerAssetPrintPiecesPanel();
    }

    public PrintPiecesPanel getSupplierOrderPrintPieces() {
        return getSupplierOrderPrintPiecesPanel();
    }

    public PrintPiecesPanel getSupplierBillPrintPieces() {
        return getSupplierBillPrintPiecesPanel();
    }

    public PrintPiecesPanel getSupplierAssetPrintPieces() {
        return getSupplierAssetPrintPiecesPanel();
    }

    public int getSelectedPanel() {
        return getJTabbedPane().getSelectedIndex();
    }

    private JPanel getJPanel() {
        if (jPanel == null) {
            FlowLayout flowLayout1 = new FlowLayout();
            jPanel = new JPanel();
            jPanel.setLayout(flowLayout1);
            flowLayout1.setHgap(2);
            flowLayout1.setVgap(2);
            flowLayout1.setAlignment(0);
            jPanel.add(getSaveButton(), null);
        }
        return jPanel;
    }

    private JButton getSaveButton() {
        if (saveButton == null) {
            saveButton = new JButton();
            saveButton.setPreferredSize(new Dimension(20, 20));
            saveButton.setBorderPainted(false);
            saveButton.setContentAreaFilled(false);
            saveButton.setFocusPainted(false);
            saveButton.setIcon(new ImageIcon(getClass().getResource("/org/jpgolay/gui/images/save.png")));
            saveButton.setToolTipText("Enregistrer");
        }
        return saveButton;
    }

    public JButton getSaveB() {
        return getSaveButton();
    }
    private JPanel jContentPane;
    private JTabbedPane jTabbedPane;
    private JPanel customerQuotePanel;
    private JPanel customerOrderPanel;
    private JPanel customerDeliveryPanel;
    private JPanel customerBillPanel;
    private JPanel customerAssetPanel;
    private JPanel supplierOrderPanel;
    private JPanel supplierBillPanel;
    private JPanel supplierAssetPanel;
    private PrintPiecesPanel customerQuotePrintPiecesPanel;
    private PrintPiecesPanel customerOrderPrintPiecesPanel;
    private PrintPiecesPanel customerDeliveryPrintPiecesPanel;
    private PrintPiecesPanel customerBillPrintPiecesPanel;
    private PrintPiecesPanel customerAssetPrintPiecesPanel;
    private PrintPiecesPanel supplierOrderPrintPiecesPanel;
    private PrintPiecesPanel supplierBillPrintPiecesPanel;
    private PrintPiecesPanel supplierAssetPrintPiecesPanel;
    private JPanel jPanel;
    private JButton saveButton;
}
